from pydantic import BaseModel
from typing import Optional
from datetime import datetime



class DahuaConfig(BaseModel):
    """大华平台配置"""
    # 基础配置
    api_host: str = "http://127.0.0.1:8000"  # 本地模拟服务器地址
    # api_host: str = "https://10.35.70.49"  # 本地模拟服务器地址
    app_key: str = "mock_app_key"
    client_id: str = 'root'
    client_secret: str = '32a85a8f-0dd9-4cec-a8df-8dee2b836007'
    username: str = 'system'
    password: str = 'jinyu123'
    
    # 新增SSL验证配置
    verify_ssl: bool = False  # 在测试环境中可以关闭SSL验证
    
    # SSL相关配置
    ssl_timeout: int = 30  # SSL操作超时时间（秒）
    force_close: bool = True
    enable_cleanup_closed: bool = True
    ttl_dns_cache: int = 300
    
    # 认证相关
    auth_path: str = "/evo-apigw/evo-oauth/1.0.0/oauth/extend/token"  # 认证接口路径
    public_key_path: str = "/evo-apigw/evo-oauth/1.0.0/oauth/public-key"  # 公钥接口路径
    access_token: Optional[str] = None
    token_expires_at: Optional[datetime] = None
    
    class Config:
        arbitrary_types_allowed = True



class PlatformConfig:
    """平台配置管理"""
    def __init__(self):
        self.dahua = DahuaConfig()  # 使用默认值
        
    
   

# 创建全局配置实例
platform_config = PlatformConfig() 
